<?php
/**
 * Created by PhpStorm.
 * User: aron
 * Date: 2019/5/8
 * Time: 8:03 PM
 */

include_once "Shape.class.php";

class Rect extends Shape
{
    private $width;
    private $height;
    private $name;

    public function __construct($width = 0, $height = 0)
    {
        $this->name = "矩形";
        $this->height = empty($height) ? 0 : $height;
        $this->width = empty($width) ? 0 : $width;
    }

    public function perimeter()
    {
        return ($this->height + $this->width) * 2;
    }

    public function area()
    {
        return ($this->height * $this->width);
    }

    /**
     * @return string
     */
    public function getName(): string
    {
        return $this->name;
    }

    /**
     * @return mixed
     */
    public function getWidth()
    {
        return $this->width;
    }

    /**
     * @return mixed
     */
    public function getHeight()
    {
        return $this->height;
    }

}